home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 12: Textmags & Docs / nf_archive_12.iso / MAGS / SOURCES / ATARI_SRC.ZIP / atari source / AHDI / SYQUEST / SQHDX / ERROR.C < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-09  |  1.3 KB  |  71 lines

  1. /*
  2.  *    ERROR.C
  3.  *
  4.  *    26-May-1988    ml.    Started this.
  5.  *
  6.  */
  7.  
  8. #include "osbind.h"
  9. #include "obdefs.h" 
  10. #include "defs.h"
  11. #include "addr.h"
  12. #include "error.h"
  13.  
  14. /*
  15.  *  Errcode()
  16.  *    Find error code for previous instruction which returned Check
  17.  *  Condition Status.
  18.  *
  19.  *  Input:
  20.  *    pdev - the physical device number (0 -> 7).
  21.  *
  22.  *  Return:
  23.  *    errnum - the error code.
  24.  */
  25. errcode(pdev)
  26. int pdev;
  27. {
  28.     char data[16];
  29.     extern long rq_sense(), ostack;
  30.     UWORD errnum;
  31.    
  32.     ostack = Super(NULL);
  33.     errnum = rq_sense(pdev, data);
  34.     delay();
  35.     Super(ostack);
  36.     
  37.     if (errnum != 0)
  38.         return err("[1][Fatal error][OK]");
  39.         
  40.     data[0] &= 0x7f;        /* mask out advalid bit */
  41.     errnum = (UWORD)data[0];
  42.     return errnum;        /* return it */
  43. }
  44.  
  45.  
  46. /*
  47.  *  Tsterr()
  48.  *    Given an error code, test if it is a medium change error
  49.  *  or a write protection error.  Put up the appropiate box if
  50.  *  it is either one of those, and return OK.  
  51.  *    If it is not either of those, return ERROR.
  52.  *
  53.  */
  54. tsterr(errnum)
  55. UWORD errnum;
  56. {
  57.     switch(errnum) {
  58.         case MDMCHGD:
  59.             err(mdmchng);
  60.             break;
  61.         
  62.         case WRTPRTD:
  63.             err(wrprotct);
  64.             break;
  65.             
  66.         default:
  67.             return ERROR;
  68.     }
  69.     return OK;
  70. }
  71.